#ifndef _core_switch_case_iterator_hpp_
#define _core_switch_case_iterator_hpp_

/** \file case_iterator.hpp
 *  \author Adrian Schweizer
 *  \created  $Mo 11 Feb 08:33:01 pm CET 2008 schwadri@SchwadriLaptop.local$
 *  \modified $Mo 11 Feb 08:34:37 pm CET 2008 schwadri@SchwadriLaptop.local$
 */

#include <boost/mpl/size.hpp>
#include <boost/mpl/size_t.hpp>

#include <boost/fusion/support/tag_of_fwd.hpp>
#include <boost/fusion/support/iterator_base.hpp>

#include <boost/static_assert.hpp>

namespace core {

    struct case_iterator_tag;

    template <typename Case, std::size_t Pos>
        struct case_iterator;
}

namespace boost { namespace fusion {

        struct random_access_traversal_tag;

        namespace traits {

            template <typename C, std::size_t P>
                struct tag_of<core::case_iterator<C,P> >
                {
                    typedef core::case_iterator_tag   type;
                };
        }
    }
}
namespace core {

    template <typename Case, std::size_t Pos>
        struct case_iterator
        :   boost::fusion::iterator_base<case_iterator<Case,Pos> >
        {
            BOOST_STATIC_ASSERT(Pos >= 0);
            typedef Case                                        case_type;
            typedef boost::mpl::size_t<Pos>                     index;
            typedef boost::fusion::random_access_traversal_tag  category;

            case_iterator(const Case& c)
            :   m_c(c)
            { }

            const Case& c() const { return m_c; }

        private:
            const Case& m_c;
        };

} // namespace core

#endif // _core_switch_case_iterator_hpp_
